<template>
  <!-- 网络安全通报详情 -->
  <h-modal class="event-modal" hideFooter v-model="show" title="网络安全通报详情" @submit="show=false">
    <div class="detail-title">
      <!-- <div class="detail-tag" v-if="eventDetailInfo.type == 0">
        市级
      </div>
      <div class="detail-tag" v-else-if="eventDetailInfo.type == 1">
        省级
      </div>
      <div class="detail-tag" v-else-if="eventDetailInfo.type == 2">
        中央
      </div> -->
      <div class="detail-tag">
        {{ eventDetailInfo.source }}
      </div>
      <h1>事件标题：{{ eventDetailInfo.title }}</h1>
      <div class="detail-weightType">
        {{ weightType[eventDetailInfo.weightType] }}
      </div>
    </div>
    <div class="detail-tags">
      <span>发文单位：{{ eventDetailInfo.company || '无' }} &nbsp;&nbsp;事件发生单位：{{ eventDetailInfo.unity || '无' }} &nbsp;&nbsp; 通报类型：{{ eventDetailInfo.type }}</span>
    </div>
    <div class="dh-footer">
      <!-- <div><SvgIcon iconClass="location (1)" />地点：{{ eventDetailInfo.territory }}</div> -->
      <div><SvgIcon iconClass="time (1)" />发文时间：{{ eventDetailInfo.reaseTime }}</div>
    </div>

    <div class="detail-content" style="margin-top: 12px" v-html="eventDetailInfo.content">

    </div>
    <!-- <template v-if="eventDetailInfo.file">
      <a-divider></a-divider>
      <div class="detail-content" v-html="eventDetailInfo.file">

      </div>
    </template> -->

  </h-modal>
</template>

<script>
import moment from 'moment';
import { detailSafeIntnet } from '@/api/serve';
// import cloneDeep from 'lodash/cloneDeep';

export default {
  props: {
    showModal: {
      type: Boolean,
      default: false
    },
    id: {
      type: String,
      default: ''
    }
  },
  model: {
    prop: 'showModal',
    event: 'update:showModal'
  },
  watch: {
    showModal: {
      handler(val) {
        this.show = val;
        if (val) {
          detailSafeIntnet({
            id: this.id
          }).then(res => {
            this.eventDetailInfo = res.data || {};
          });
        }
      },
      immediate: true
    },
    show(val) {
      this.$emit('update:showModal', val);
    }
  },
  data() {
    return {
      moment,
      show: false,
      eventDetailInfo: {},
      weightType: {
        0: '低',
        1: '中',
        2: '高'
      }
    };
  },
  methods: {
    submit() {

    }
  }
};
</script>

<style lang="less" scoped>
  .detail-title {
    display: flex;
    justify-content: center;
    align-items: center;
    // margin-top: -20px;
    .detail-tag {
      width: 57px;
      height: 26px;
      border: 1px solid #1FAF7A;
      border-radius: 5px;
      font-size: 16px;
      font-weight: 400;
      color: #1FAF7A;
      text-align: center;
      line-height: 25px;
      margin-right: 13px;
      transform: translate(0, 1px);
    }
    h1 {
      font-size: 24px;
      font-weight: 500;
      color: #333333;
      margin: 0;
      line-height: 1.1;
      max-width: 80%;
    }
  }
  .detail-tags {
    font-size: 16px;
    font-weight: 400;
    color: #0478FE;
    margin: 0 auto;
    text-align: center;
    margin-top: 18px;
    .ant-divider {
      background: #0478FE;
    }
  }
  .detail-weightType {
    font-size: 16px;
    font-weight: 400;
    color: #0478FE;
    margin-left: 12px;
    line-height: 1;
  }
.dh-footer {
    // position: absolute;
    // bottom: 36px;
    font-size: 16px;
    display: flex;
    width: 94%;
    justify-content: center;
    margin-top: 8px;
    svg {
      margin-right: 8px;
    }
    >div:last-child {
      text-align: right;
    }
  }
</style>
<style lang="less">
.detail-content {
  margin-top: 40px;
  color: #333;
  font-size: 16px;
  line-height: 2;
  >p {

  }
  img {
    max-width: 100%;
  }
}
</style>
